package com.darsystems.foghourz.client;

import java.util.ArrayList;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;

public class FBLogin implements EntryPoint {

	private FBLoginPanel loginPanel;
	private StatusDisplay statusDisplay;
	
	@Override
	public void onModuleLoad() {
		
		ArrayList<Authorizer> authorizers = new ArrayList<Authorizer>();
		authorizers.add(new GoogleAuthorizer());
		
		StatusPanel status = new StatusPanel("Starting...", authorizers, new LoginHandler()
		{
			public void loginFailed() {
			}
			public void loginSucceeded() {
				loginPanel.getLoggedOnToFB();
			}
		});
		statusDisplay = status;
		
		loginPanel = new FBLoginPanel(this.statusDisplay, new LoginHandler()
		{
			public void loginFailed() {
			}
			public void loginSucceeded() {
				Window.Location.replace(GWT.getHostPageBaseURL() + "Foghourz.html");
			}
		});
		
		RootPanel.get("statusPanelDiv").add(status);
		RootPanel.get("loginDiv").add(loginPanel);
		status.getAuthorized();
		
		
	}

}
